<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link href="static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
    <title>大会后台</title>
    <link rel="Shortcut Icon" href="/admin/imgs/logo.ico"/>

    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
    <script type="text/javascript" src="js/admin.js"></script>
</head>
<body>
<div class="loginWraper" style="margin:15% auto;width:500px;">
    <div id="loginform" class="loginBox">
        <form class="form form-horizontal">
            <div class="row cl">
                <label class="form-label col-xs-3" style="padding-top:5px;">
                    <i class="Hui-iconfont">&#xe60d;</i>
                </label>
                <div class="formControls col-xs-8">
                    <input type="text" placeholder="账号" class="input-text size-L" style="border-radius:3px;" id="name"/>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3" style="padding-top:5px;">
                    <i class="Hui-iconfont">&#xe60e;</i>
                </label>
                <div class="formControls col-xs-8">
                    <input type="password" placeholder="密码" class="input-text size-L" style="border-radius:3px;" id="pwd"/>
                </div>
            </div>
            <div class="row cl">
                <div class="formControls col-xs-8 col-xs-offset-3">
                    <input type="button" class="btn btn-success radius size-L" value=" 登 &nbsp; 录 " onclick="dologin()">
                </div>
            </div>
        </form>
    </div>
</div>

<span id="pop"></span>
</body>
</html>

<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
    // (function(){
    //     // getSess();
    // })();
    // function getSess(){
    //     $.ajax({
    //         type: 'post',
    //         url: domain+'admin/info',
    //         data: {},
    //         success: function (res) {
    //             console.log(res);
    //             res = JSON.parse(res);
    //             if (res.code==0) {}
    //         },
    //         error: function () {
    //             console.log('网络异常');
    //         }
    //     });
    // }
    function dologin(){
        var name = $('#name').val();
        var pwd = $('#pwd').val();
        if (!name || !pwd) { 
            pop({msg:'账号或密码必填'}); return 
        }
        var formData = {name:name,pwd:pwd};
        console.log(formData);
        $.ajax({
            type: 'post',
            url: domain+'dologin',
            data: formData,
            success: function (res) {
                console.log(res);
                res = JSON.parse(res);
                if (res.code!=0) {
                    pop({msg:res.msg}); return
                }
                var d = res.data;
                var loginInfo = {
                    adminid: d.adminid, adminName: d.adminName,
                };
                setLoginInfo({val:loginInfo});
                pop({msg:'成功，跳转中...'});
                console.log('kk');
                setTimeout(function(){
                    window.location.href = 'index.html';
                },1000);
            },
            error: function () {
                console.log('网络异常');
                pop({msg:'网络异常'});
            }
        });
    }
</script>